import { QWebChannel } from '../plugins/qwebchannel'

export function qtTransPort(res, key = 'jscallme') {
  try {
    new QWebChannel(parent.qt.webChannelTransport, function (channel) {
      const webobj = channel.objects.webobj
      window.foo = webobj
      webobj.content = res
      webobj[key]()
    })
  } catch (err) {
    console.log('报错了', err)
  }
}